package com.ming.sdk.config;

import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.retry.ExponentialBackoffRetry;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Auther: tangC
 * @Date: 2020/7/3 16:06
 * @Description:
 */
@Configuration
public class ZKConfig {

    @Value("${com.system.setting}")
    private String host;

    @Bean
    public CuratorFramework getCuratorFramework(){
        CuratorFramework curatorFramework = CuratorFrameworkFactory.builder()
                .connectString(host)
                .retryPolicy(new ExponentialBackoffRetry(1000, 3))
                .build();
        return curatorFramework;
    }
}
